﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;

namespace Final.App_Code
{
    public class StudentDataClass
    {
        public void createstudent( e){
        SqlConnection conn = null;
            try
            {
                conn = new SqlConnection();
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["studentDBString"].ConnectionString;
                conn.Open();
                SqlCommand comm = new SqlCommand();
                comm.Connection = conn;

                comm.CommandText = "Insert into Student (Admin_No,Name,Password,Course_Code,Course_Name,Contact,Email)" + 
                " VALUES (@Description, Admin_No = @admin_no, Name = @name, Password = @password, Course_Code = @course_code," + 
                " Course_Name = @course_name, Contact = @contact, Email = @email)";
               
                comm.Parameters.AddWithValue("@admin_no", e.EventName);
                comm.Parameters.AddWithValue("@name", e.EventVenue);
                comm.Parameters.AddWithValue("@password", e.Description);
                comm.Parameters.AddWithValue("@course_code", e.StartDate);
                comm.Parameters.AddWithValue("@course_name", e.EndDate);
                comm.Parameters.AddWithValue("@contact", e.StartTime);
                comm.Parameters.AddWithValue("@email", e.EndTime);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                conn.Close();
            }
        }
    }
}